package com.itheima.mapper;

import com.itheima.pojo.Question;
import com.itheima.pojo.Survey;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface QuestionMapper {

    @Insert("insert into question_info values (null,#{surveyId},#{questionType},#{questionName},#{questionDescription},#{questionSort},#{requiredFlag} )")
    void add(Question question);

    /**
     * 根据问卷id进行查询
     * @param sid
     * @return
     */
    @Select("select * from question_info where survey_id = #{sid} ")
    @ResultMap("questionResultMap")
    List<Question> selectAll(@Param("sid") int sid);

}
